package threaddemo;

public class MyThread extends Thread {
    @Override
    public void run() {//记录要执行的任务
        while (true) {

            System.out.println("hello,my thread");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            //为了不过分占用cpu---
        }
    }
}
